<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title></title>
    <meta name="description" content="">
    <meta name="keywords" content="">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="renderer" content="webkit">
    <meta http-equiv="Cache-Control" content="no-siteapp"/>
    <link rel="icon" type="image/png" href="home/favicon.ico">
    {{--<link href="__PUBLIC__/bootstrap/css/bootstrap.min.css" rel="stylesheet">--}}
    <link rel="stylesheet" href="home/flexslider/flexslider.css">
    <link rel="stylesheet" href="home/css/common.css">
    <script src="home/js/fontSize.js"></script>
</head>
<body>

<div id="globalLoading" class="global-loading">
    <div class="global-loading-logo">
        <div id="globalLoadingAnim" class="global-loading-anim"></div>
    </div>
    <div class="global-loading-text">正在努力为您加载中...</div>
</div>

<script src="home/js/loading.js"></script>

<div id="wrapper">
    <div class="page-index" id="home" data-log="首页">
        <div class="index-header">
            <div class="search_bar">
                <a href="/1/#/search/index">
                    <span class="icon icon-search"></span>
                    <span class="text">搜索商品名称</span>
                </a>
            </div>
            <div class="search_bottom"></div>
        </div>

        <!--焦点图-->
        <section class="slider">
            <div class="flexslider">
                <ul class="slides">
                    <li>
                        <a href=""><img src="http://i8.mifile.cn/v1/a1/T1_1W_BgVv1RXrhCrK!720x360.jpg"/></a>
                    </li>
                    <li>
                        <img src="http://i8.mifile.cn/v1/a1/T12LdgBXZv1RXrhCrK!720x360.jpg"/>
                    </li>
                    <li>
                        <img src="http://i8.mifile.cn/v1/a1/T1zgZvBgK_1RXrhCrK!720x360.jpg"/>
                    </li>
                    <li>
                        <img src="http://i8.mifile.cn/v1/a1/T1m4bgBsdv1RXrhCrK!720x360.jpg"/>
                    </li>
                    <li>
                        <img src="http://i8.mifile.cn/v1/a1/T17XD_Bjxv1RXrhCrK!720x360.jpg"/>
                    </li>
                </ul>
            </div>
        </section>

        <!--推荐商品-->
        <div class="list">
            <div class="section">
                <div class="mcells_auto_fill">
                    <div class="body">
                        <div>
                            <div class="items">
                                <img src="http://i8.mifile.cn/v1/a1/T1lJdgB7hv1RXrhCrK.jpg">
                            </div>
                        </div>
                        <div>
                            <div class="items">
                                <img src="http://i8.mifile.cn/v1/a1/T1a9hgB7_v1RXrhCrK.jpg">
                            </div>
                        </div>
                        <div>
                            <div class="items">
                                <img src="http://i8.mifile.cn/v1/a1/T1F6WgBQYv1RXrhCrK.jpg">
                            </div>
                        </div>
                    </div>
                </div>
            </div>

           <tbody>
            @foreach($products as $product)
            <div class="section">
                <div>
                    <div class="item">
                        <div class="img">
                            <img class="ico" src="{{$product->thumb}}">
                            <img class="tag " src="http://c1.mifile.cn/f/i/f/mishop/iic/xp.png">
                        </div>
                        <div class="info">
                            <div class="name"><p>{{$product->name}}</p></div>
                            <div class="brief"><p>{{$product->desc}}</p></div>
                            <div class="price"><p>{{$product->unit_price}}元 起</p></div>
                        </div>
                    </div>
                </div>
            </div>
            @endforeach
            </tbody>
        </div>
        <div class="footer">
            <ul>
                <li>
                    <a href="{{route('index')}}" class="on">
                        <div class="nav">
                            <div class="ih ispr"></div>
                            <p>商城</p>
                        </div>
                    </a>
                </li>
                <li>
                    <a href="/1/#/product/category">
                        <div class="nav">
                            <div class="ic ispr"></div>
                            <p>分类</p>
                        </div>
                    </a>
                </li>
                <li>
                    <a href="/1/#/cart/index">
                        <div class="nav">
                            <div class="is ispr"></div>
                            <p>购物车</p>
                        </div>
                    </a>
                </li>
                <li>
                    <a href="/1/#/user/index">
                        <div class="nav">
                            <div class="if ispr"></div>
                            <p>服务</p>
                        </div>
                    </a>
                </li>
            </ul>
        </div>
    </div>
</div>

<script src="home/js/jquery.min.js"></script>
<script src="home/js/common.js"></script>

<script defer src="home/flexslider/jquery.flexslider.js"></script>
<script type="text/javascript">
    $(window).load(function () {
        $('.flexslider').flexslider({
            animation: "slide",
            directionNav: false
        });
    });
</script>
<script>
    $(function () {
        var page = 1;

        $(window).scroll(function () {
            if ($(window).scrollTop() == $(document).height() - $(window).height()) {
                page++;
                var _this = $(this);

                $.ajax({
                    type:"patch",
                    url:"more",
                    data:page,
                    success:function($products){
                        $.each($products, function (k, v) {
                            var html = '<div class="section">'+
                                    '<div>'+
                                    '<div class="item">'+
                                    '<div class="img">'+
                                    '<img class="ico" src="'+v.thumb+'">'+
                                    '<img class="tag " src="http://c1.mifile.cn/f/i/f/mishop/iic/xp.png">'+
                                    '</div>'+
                                    '<div class="info">'+
                                    '<div class="name"><p>'+v.name+'</p></div>'+
                                    '<div class="brief"><p>'+v.desc+'</p></div>'+
                                    '<div class="price"><p>'+v.unit_price+'元 起</p></div>'
                            //   $("tbody").append(html);
                            $(html).appendTo("tbody").fadeIn(300);
                        })
                    }
                })
           }
        })
</script>
</body>
</html>
